package com.ruoyi.vpn.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.vpn.mapper.VpnUserMapper;
import com.ruoyi.vpn.domain.VpnUser;
import com.ruoyi.vpn.service.IVpnUserService;

/**
 * userService业务层处理
 * 
 * @author Edwin
 * @date 2024-01-08
 */
@Service
public class VpnUserServiceImpl implements IVpnUserService 
{
    @Autowired
    private VpnUserMapper vpnUserMapper;

    /**
     * 查询user
     * 
     * @param userId user主键
     * @return user
     */
    @Override
    public VpnUser selectVpnUserByUserId(Long userId)
    {
        return vpnUserMapper.selectVpnUserByUserId(userId);
    }

    /**
     * 查询user列表
     * 
     * @param vpnUser user
     * @return user
     */
    @Override
    public List<VpnUser> selectVpnUserList(VpnUser vpnUser)
    {
        List<VpnUser> vpnUsers = vpnUserMapper.selectVpnUserList(vpnUser);
        System.out.println("vpnUsers = " + vpnUsers);
        return vpnUsers;
    }

    /**
     * 新增user
     * 
     * @param vpnUser user
     * @return 结果
     */
    @Override
    public int insertVpnUser(VpnUser vpnUser)
    {
        vpnUser.setCreateTime(DateUtils.getNowDate());
        //设置默认图片路径

        System.out.println("vpnUser = " + vpnUser);
        return vpnUserMapper.insertVpnUser(vpnUser);
    }

    /**
     * 修改user
     * 
     * @param vpnUser user
     * @return 结果
     */
    @Override
    public int updateVpnUser(VpnUser vpnUser)
    {
        vpnUser.setUpdateTime(DateUtils.getNowDate());
        return vpnUserMapper.updateVpnUser(vpnUser);
    }

    /**
     * 批量删除user
     * 
     * @param userIds 需要删除的user主键
     * @return 结果
     */
    @Override
    public int deleteVpnUserByUserIds(Long[] userIds)
    {
        return vpnUserMapper.deleteVpnUserByUserIds(userIds);
    }

    /**
     * 删除user信息
     * 
     * @param userId user主键
     * @return 结果
     */
    @Override
    public int deleteVpnUserByUserId(Long userId)
    {
        return vpnUserMapper.deleteVpnUserByUserId(userId);
    }

    @Override
    public List<VpnUser> selectVpnUserListStrict(VpnUser vpnUser) {
        List<VpnUser> vpnUsers = vpnUserMapper.selectVpnUserListStrict(vpnUser);

        return vpnUsers;
    }
}
